<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let fetchQueue = Promise.resolve();

        function fetchPageData(page) {
            fetchQueue = fetchQueue.then(async () => {
                const response = await fetch(`/api/data?page=${page}`);
                const data = await response.json();
                renderData(data);
            }).catch(error => {
                console.error('请求失败:', error);
            });
        }

        // Promise.resolve()
        //     .then(() => fetch page 1)
        //     .then(() => fetch page 2)
        //     .then(() => fetch page 3)

    </script>
</body>
</html>